<?
//引入所有子系统信息
include_once("../../../common/script/extender_import.php");




//删除所有旧的数据
$del_milk_sql="delete from ".$table_prefix."product_schedule"." where product_nid = '".$_REQUEST['nid']."'";
$query = do_query($del_milk_sql) or die (mysqli_error().$del_milk_sql);





foreach ($_REQUEST['milk'] as $apply_date => $milk_name) {
    if($milk_name != '')
    {
    $_schedule = []; // 每次新建一个新数组
    $_schedule['ai_product_nid'] = $_REQUEST['nid'];
    $_schedule['ai_product_name'] = $_REQUEST['ai_product_name'];
    $_schedule['ai_milk_name'] = $milk_name;
    $_schedule['ai_apply_date'] = $apply_date; // ✅ 获取 key 作为日期
    $_schedule['ai_startdate'] = $_REQUEST['startdate'];
    $_schedule['ai_enddate'] = $_REQUEST['startdate'];

    $sql = insert_data($table_prefix . "product_schedule", $_schedule);
    $query = do_query($sql) or die(mysqli_error() . $sql);

    }
}






?>

